home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 January: Mac OS SDK / Dev.CD Jan 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / CIncludes / Aliases.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  6.8 KB  |  219 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Aliases.h
  3.  
  4.      Contains:    Alias Manager Interfaces.
  5.  
  6.      Version:    Technology:    Mac OS 8.1
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1989-1995, 1997-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __ALIASES__
  18. #define __ALIASES__
  19.  
  20. #ifndef __MACTYPES__
  21. #include <MacTypes.h>
  22. #endif
  23. #ifndef __APPLETALK__
  24. #include <AppleTalk.h>
  25. #endif
  26. #ifndef __FILES__
  27. #include <Files.h>
  28. #endif
  29.  
  30.  
  31.  
  32. #if PRAGMA_ONCE
  33. #pragma once
  34. #endif
  35.  
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif
  39.  
  40. #if PRAGMA_IMPORT
  41. #pragma import on
  42. #endif
  43.  
  44. #if PRAGMA_STRUCT_ALIGN
  45.     #pragma options align=mac68k
  46. #elif PRAGMA_STRUCT_PACKPUSH
  47.     #pragma pack(push, 2)
  48. #elif PRAGMA_STRUCT_PACK
  49.     #pragma pack(2)
  50. #endif
  51.  
  52.  
  53. enum {
  54.     rAliasType                    = FOUR_CHAR_CODE('alis')        /* Aliases are stored as resources of this type */
  55. };
  56.  
  57.  
  58. enum {
  59.                                                                 /* define alias resolution action rules mask */
  60.     kARMMountVol                = 0x00000001,                    /* mount the volume automatically */
  61.     kARMNoUI                    = 0x00000002,                    /* no user interface allowed during resolution */
  62.     kARMMultVols                = 0x00000008,                    /* search on multiple volumes */
  63.     kARMSearch                    = 0x00000100,                    /* search quickly */
  64.     kARMSearchMore                = 0x00000200,                    /* search further */
  65.     kARMSearchRelFirst            = 0x00000400                    /* search target on a relative path first */
  66. };
  67.  
  68.  
  69. enum {
  70.                                                                 /* define alias record information types */
  71.     asiZoneName                    = -3,                            /* get zone name */
  72.     asiServerName                = -2,                            /* get server name */
  73.     asiVolumeName                = -1,                            /* get volume name */
  74.     asiAliasName                = 0,                            /* get aliased file/folder/volume name */
  75.     asiParentName                = 1                                /* get parent folder name */
  76. };
  77.  
  78. /* ResolveAliasFileWithMountFlags options */
  79.  
  80. enum {
  81.     kResolveAliasFileNoUI        = 0x00000001                    /* no user interaction during resolution */
  82. };
  83.  
  84. /* define the alias record that will be the blackbox for the caller */
  85.  
  86. struct AliasRecord {
  87.     OSType                             userType;                    /* appl stored type like creator type */
  88.     unsigned short                     aliasSize;                    /* alias record size in bytes, for appl usage */
  89. };
  90. typedef struct AliasRecord                AliasRecord;
  91.  
  92. typedef AliasRecord *                    AliasPtr;
  93. typedef AliasPtr *                        AliasHandle;
  94. /* alias record information type */
  95. typedef short                             AliasInfoType;
  96. /*  create a new alias between fromFile-target and return alias record handle  */
  97. EXTERN_API( OSErr )
  98. NewAlias                        (ConstFSSpecPtr         fromFile,
  99.                                  const FSSpec *            target,
  100.                                  AliasHandle *            alias)                                TWOWORDINLINE(0x7002, 0xA823);
  101.  
  102. /* create a minimal new alias for a target and return alias record handle */
  103. EXTERN_API( OSErr )
  104. NewAliasMinimal                    (const FSSpec *            target,
  105.                                  AliasHandle *            alias)                                TWOWORDINLINE(0x7008, 0xA823);
  106.  
  107. /* create a minimal new alias from a target fullpath (optional zone and server name) and return alias record handle  */
  108. EXTERN_API( OSErr )
  109. NewAliasMinimalFromFullPath        (short                     fullPathLength,
  110.                                  const void *            fullPath,
  111.                                  ConstStr32Param         zoneName,
  112.                                  ConstStr31Param         serverName,
  113.                                  AliasHandle *            alias)                                TWOWORDINLINE(0x7009, 0xA823);
  114.  
  115. /* given an alias handle and fromFile, resolve the alias, update the alias record and return aliased filename and wasChanged flag. */
  116. EXTERN_API( OSErr )
  117. ResolveAlias                    (ConstFSSpecPtr         fromFile,
  118.                                  AliasHandle             alias,
  119.                                  FSSpec *                target,
  120.                                  Boolean *                wasChanged)                            TWOWORDINLINE(0x7003, 0xA823);
  121.  
  122. /* given an alias handle and an index specifying requested alias information type, return the information from alias record as a string. */
  123. EXTERN_API( OSErr )
  124. GetAliasInfo                    (AliasHandle             alias,
  125.                                  AliasInfoType             index,
  126.                                  Str63                     theString)                            TWOWORDINLINE(0x7007, 0xA823);
  127.  
  128.  
  129. EXTERN_API( OSErr )
  130. IsAliasFile                        (const FSSpec *            fileFSSpec,
  131.                                  Boolean *                aliasFileFlag,
  132.                                  Boolean *                folderFlag)                            TWOWORDINLINE(0x702A, 0xA823);
  133.  
  134. EXTERN_API( OSErr )
  135. ResolveAliasWithMountFlags        (const FSSpec *            fromFile,
  136.                                  AliasHandle             alias,
  137.                                  FSSpec *                target,
  138.                                  Boolean *                wasChanged,
  139.                                  unsigned long             mountFlags)                            TWOWORDINLINE(0x702B, 0xA823);
  140.  
  141. /* 
  142.   Given a file spec, return target file spec if input file spec is an alias.
  143.   It resolves the entire alias chain or one step of the chain.  It returns
  144.   info about whether the target is a folder or file; and whether the input
  145.   file spec was an alias or not. 
  146. */
  147. EXTERN_API( OSErr )
  148. ResolveAliasFile                (FSSpec *                theSpec,
  149.                                  Boolean                 resolveAliasChains,
  150.                                  Boolean *                targetIsFolder,
  151.                                  Boolean *                wasAliased)                            TWOWORDINLINE(0x700C, 0xA823);
  152.  
  153.  
  154. EXTERN_API( OSErr )
  155. ResolveAliasFileWithMountFlags    (FSSpec *                theSpec,
  156.                                  Boolean                 resolveAliasChains,
  157.                                  Boolean *                targetIsFolder,
  158.                                  Boolean *                wasAliased,
  159.                                  unsigned long             mountFlags)                            TWOWORDINLINE(0x7029, 0xA823);
  160.  
  161. EXTERN_API( OSErr )
  162. FollowFinderAlias                (ConstFSSpecPtr         fromFile,
  163.                                  AliasHandle             alias,
  164.                                  Boolean                 logon,
  165.                                  FSSpec *                target,
  166.                                  Boolean *                wasChanged)                            TWOWORDINLINE(0x700F, 0xA823);
  167.  
  168. /* 
  169.    Low Level Routines 
  170. */
  171. /* given a fromFile-target pair and an alias handle, update the lias record pointed to by alias handle to represent target as the new alias. */
  172. EXTERN_API( OSErr )
  173. UpdateAlias                        (ConstFSSpecPtr         fromFile,
  174.                                  const FSSpec *            target,
  175.                                  AliasHandle             alias,
  176.                                  Boolean *                wasChanged)                            TWOWORDINLINE(0x7006, 0xA823);
  177.  
  178.  
  179. typedef CALLBACK_API( Boolean , AliasFilterProcPtr )(CInfoPBPtr cpbPtr, Boolean *quitFlag, Ptr myDataPtr);
  180. typedef STACK_UPP_TYPE(AliasFilterProcPtr)                         AliasFilterUPP;
  181. enum { uppAliasFilterProcInfo = 0x00000FD0 };                     /* pascal 1_byte Func(4_bytes, 4_bytes, 4_bytes) */
  182. #define NewAliasFilterProc(userRoutine)                         (AliasFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppAliasFilterProcInfo, GetCurrentArchitecture())
  183. #define CallAliasFilterProc(userRoutine, cpbPtr, quitFlag, myDataPtr)  CALL_THREE_PARAMETER_UPP((userRoutine), uppAliasFilterProcInfo, (cpbPtr), (quitFlag), (myDataPtr))
  184.  
  185. /*  Given an alias handle and fromFile, match the alias and return aliased filename(s) and needsUpdate flag */
  186. EXTERN_API( OSErr )
  187. MatchAlias                        (ConstFSSpecPtr         fromFile,
  188.                                  unsigned long             rulesMask,
  189.                                  AliasHandle             alias,
  190.                                  short *                aliasCount,
  191.                                  FSSpecArrayPtr         aliasList,
  192.                                  Boolean *                needsUpdate,
  193.                                  AliasFilterUPP         aliasFilter,
  194.                                  void *                    yourDataPtr)                        TWOWORDINLINE(0x7005, 0xA823);
  195.  
  196.  
  197.  
  198.  
  199. #if PRAGMA_STRUCT_ALIGN
  200.     #pragma options align=reset
  201. #elif PRAGMA_STRUCT_PACKPUSH
  202.     #pragma pack(pop)
  203. #elif PRAGMA_STRUCT_PACK
  204.     #pragma pack()
  205. #endif
  206.  
  207. #ifdef PRAGMA_IMPORT_OFF
  208. #pragma import off
  209. #elif PRAGMA_IMPORT
  210. #pragma import reset
  211. #endif
  212.  
  213. #ifdef __cplusplus
  214. }
  215. #endif
  216.  
  217. #endif /* __ALIASES__ */
  218.  
  219.